{% extends "./inc/base.html" %}
{% block style%}
<link href="/static/assets/css/layout-shop.css" rel="stylesheet" type="text/css"/>
{% endblock %}
{% block content %}


<!-- CART -->
<form class="form-post" method="post" action="/center/cart/createorder">
    <section>
        <div class="container">

            <div class="row process-wizard process-wizard-primary">

                <div class="col-xs-4 process-wizard-step complete">
                    <div class="text-center process-wizard-stepnum">第一步</div>
                    <div class="progress">
                        <div class="progress-bar"></div>
                    </div>
                    <a class="process-wizard-dot"></a>
                    <div class="process-wizard-info text-center">购物车</div>
                </div>

                <div class="col-xs-4 process-wizard-step active"><!-- complete -->
                    <div class="text-center process-wizard-stepnum">第二步</div>
                    <div class="progress">
                        <div class="progress-bar"></div>
                    </div>
                    <a class="process-wizard-dot"></a>
                    <div class="process-wizard-info text-center">确认订单信息</div>
                </div>

                <div class="col-xs-4 process-wizard-step disabled"><!-- active -->
                    <div class="text-center process-wizard-stepnum">第三步</div>
                    <div class="progress">
                        <div class="progress-bar"></div>
                    </div>
                    <a class="process-wizard-dot"></a>
                    <div class="process-wizard-info text-center">订购完成</div>
                </div>

            </div>


            <div class="panel panel-default margin-bottom-0">
                <div class="panel-body ">
                    <div class="heading-title heading-dotted text-center margin-bottom-15">
                        <h4>填写并核对 <span>[订单信息]</span></h4>
                    </div>
                    {#<section class="padding-bottom-15 padding-top-0">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>收货人信息</h5>
                            <a class="btn btn-danger btn-xs add-addr-btn noradius pull-right margin-top-0"
                               data-toggle="modal" data-target=".add-addr-dialog"> <i class="fa fa-plus-square"></i>
                                新增收货地址</a>

                        </div>
                        <div class="addr-box">
                            {% for val in addrlist %}

                            <div class="icheck addr-list m-b">
                                <div class="item">
                                    <input type="radio" name="address" value="{{val.id}}" {% if val.is_default== 1 %}
                                           checked {% endif%}>
                                    <label>
                                        <ul class="text-left list-inline list-separator margin-bottom-0">
                                            {% if val.is_default == 1 %}
                                            <li class="label label-info">
                                                默认地址
                                            </li>
                                            {% endif%}
                                            <li>
                                                {{val.accept_name}}
                                            </li>
                                            <li>
                                                {{val.province}}
                                            </li>
                                            <li>
                                                {{val.city}}
                                            </li>
                                            <li>{{val.county}}</li>
                                            <li>
                                                {{val.addr}}
                                            </li>
                                            <li>{{val.mobile}}</li>
                                        </ul>
                                    </label>
                                </div>
                                <div class="item">
                                    {% if val.is_default == 0 %} <a href="#" class="btn btn-default btn-xs is_d"
                                                                    data-addr-id="{{val.id}}"><i
                                        class="fa fa-check white"></i> 设为默认 </a> {% endif%}
                                    <a href="/center/address/editaddrmodal/?id={{val.id}}"
                                       class="btn btn-default btn-xs edit" data-toggle="ajaxModal"> <i
                                            class="fa fa-edit white"></i> 编辑 </a>
                                    <a href="#" class="btn btn-default btn-xs del swal" data-addr-id="{{val.id}}"><i
                                            class="fa fa-times white"></i> 删除 </a>
                                </div>

                            </div>
                            {%else%}
                            <div class="alert alert-mini alert-warning margin-bottom-0"><!-- WARNING -->
                                <button type="button" class="close" data-dismiss="alert">
                                    <span aria-hidden="true">×</span>
                                    <span class="sr-only">Close</span>
                                </button>
                                <strong>提示!</strong> 您还没有收货地址，请先添加.
                            </div>
                            {% endfor %}

                        </div>
                    </section>#}
                    <section class="padding-bottom-15 padding-top-15" style="display: none;">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>支付方式</h5>
                        </div>
                        <div class="pay-box">
                            <div class="icheck pay-list m-b">
                                {% for val in paylist %}
                                <div class="item">
                                    <input type="radio" name="payment" value="{{val.id}}" {% if val.sort== 1 %} checked
                                           {% endif%}>
                                    <label><img src="{{val.logo}}"/> {{val.title}} </label>
                                </div>
                                {% endfor %}
                                {% if config.setup.PREPAID == 0 %}
                                <div class="item">
                                    <input type="radio" name="payment" value="100" {% if paylist|length== 0 %} checked
                                           {% endif%}>
                                    <label><img src="/static/admin/img/pingxx/yfk.png"/> 预付款支付 </label>
                                </div>
                                {% endif %}
                                {% if config.setup.COD == 0 %}
                                <div class="item">
                                    <input type="radio" name="payment" value="1001" {% if paylist|length== 0 and
                                           controller.setup.PREPAID== 1 %} checked {% endif%}>
                                    <label><img src="/static/admin/img/pingxx/hdfk.png"/> 货到付款 </label>
                                </div>
                                {% endif %}
                            </div>


                        </div>
                    </section>
                    <section class="padding-bottom-0 padding-top-15">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>送货清单</h5>
                            <a href="/center/cart"
                               class="btn btn-info btn-xs add-addr-btn noradius pull-right margin-top-0"> <i
                                    class="fa fa-opencart"></i> 返回修改购物车</a>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-hover margin-bottom-0">
                                <thead>
                                <tr class="active">
                                    <th style="width: 60px">商品</th>
                                    <th style="width: 350px">名称</th>
                                    <th>规格</th>
                                    <!--<th>单价</th>-->
                                    <th>数量</th>
                                    <!--<th>小计</th>-->
                                </tr>
                                </thead>
                                <tbody>
                                {% for val in check_goods%}
                                <tr>
                                    <td><img src="{{val.pic}}" alt="" width="45" class="img-responsive img-thumbnail"/>
                                    </td>
                                    <td>{{val.title}}</td>
                                    <td>{% if val.type%}{{val.type}}{%endif%}</td>
                                    <!--<td>¥{{val.unit_price|formatCurrency}}</td>-->
                                    <td>{{val.qty}}</td>
                                    <!--<td>¥{{val.price|formatCurrency}}</td>-->
                                </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </section>

                    {%if controller.setup.IS_INVOICE == 1%}
                    <section class="padding-bottom-15 padding-top-15">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>发票信息</h5>
                        </div>
                        <div class="table-responsive">
                            <table class="table">

                                <tbody>
                                <tr class="success">
                                    <td>Value 1</td>
                                    <td>Value 2</td>
                                    <td>Value 3</td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                    </section>

                    <section class="padding-bottom-15 padding-top-15">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>订单促销活动</h5>
                        </div>
                        <div class="table-responsive">
                            <table class="table">

                                <tbody>
                                <tr class="success">
                                    <td>Value 1</td>
                                    <td>Value 2</td>
                                    <td>Value 3</td>
                                </tr>

                                </tbody>
                            </table>
                        </div>
                    </section>
                    {%endif%}
                    <section class="padding-bottom-15 padding-top-15">
                        <div class="heading-title heading-line-single margin-bottom-20">
                            <h5>请选择合作公司</h5>
                        </div>
                        <div class="fancy-form">
                            <select class="form-control pointer " name="company" required>
                                <option value="" selected>--- 选择公司 ---</option>
                                {% for item in controller.companyList %}
                                <option value="{{item.id}}">{{item.subcompanyname}}</option>
                                {% endfor %}
                            </select>
                        </div>
                    </section>
                </div>
            </div>
            <div class="row">
                <div class="col-md-8 hidden-xs"></div>
                <div class="col-md-4 col-xs-12">
                    <div class="table-responsive margin-top-20">
                        <table class="table margin-bottom-0">
                            <tbody>
                            <!--<tr>
                                <td class="text-right"><span class="text-danger">{{nums}}</span> 件商品，总商品金额：</td>
                                <td>¥ <span class="text-danger">{% if real_amount %}{{real_amount|formatCurrency}}{%else%}0.00{%endif%}</span>
                                </td>
                            </tr>-->
                            <tr class="danger">
                                <td class="text-right text-danger size-18"><span class="text-danger">共 {{nums}}</span> 件商品{#，总商品金额：#}</td>
                                {#<td class="text-danger size-18" id="order_amount">¥{{order_amount|formatCurrency}}</td>#}
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="callout alert alert-default  margin-bottom-60">
                <div class="row">
                    <div class="col-md-8 col-sm-8 showaddr"><!-- left text -->
                        {#{% for val in addrlist %}
                        {% if val.is_default == 1 %}
                        <p class="size-14 margin-bottom-6"><strong>寄送至：</strong>{{val.province}} {{val.city}}
                            {{val.county}} {{val.addr}} </p>
                        <p class="size-14"><strong>收货人：</strong>{{val.accept_name}} {{val.mobile}}</p>
                        {%endif%}
                        {%endfor%}#}
                    </div><!-- /left text -->
                    <div class="col-md-4 col-sm-4 text-right"><!-- right btn -->
                        <input type="hidden" value="{{check_goods|jsonToStr}}" name="goodslist">
                        <button target-form="form-post" class="btn btn-danger btn-lg ajax-post" type="submit">确认并提交订单
                        </button>
                    </div><!-- /right btn -->

                </div>

            </div>
        </div>
    </section>
</form>
<!-- /CART -->

<div class="modal fade add-addr-dialog" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
     aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <!-- header modal -->
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title " id="myLargeModalLabel">新增收货人信息</h4>
            </div>

            <!-- body modal -->
            <div class="modal-body">
                <form method="post" class="add-addr">
                    <fieldset>
                        <!-- required [php action request] -->
                        <div class="row">
                            <div class="form-group" id="areas">
                                <div class="col-md-3 col-sm-12">
                                    <label>所在地区（省份/直辖市） *</label>
                                    <select class="form-control pointer " id="province" name="province" required>
                                        <option value="">--- 省份/直辖市 ---</option>

                                    </select>
                                </div>
                                <div class="col-md-3 col-sm-12">
                                    <label>（市） *</label>
                                    <select class="form-control pointer " id="city" name="city" required>
                                        <option value="">--- 市 ---</option>

                                    </select>
                                </div>
                                <div class="col-md-3 col-sm-12">
                                    <label>（县/区） *</label>
                                    <select class="form-control pointer " id="county" name="county" required>
                                        <option value="">--- 县/区 ---</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <div class="col-md-12 col-sm-12">
                                    <label>街道地址 *</label>
                                    <textarea class="form-control required" name="addr" required></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="form-group">
                                <div class="col-md-6 col-sm-6">
                                    <label>邮政编码 *</label>
                                    <input type="text" class="form-control required" value="" name="zip" required>
                                </div>
                                <div class="col-md-6 col-sm-6">
                                    <label>手机号码 *</label>
                                    <input type="text" class="form-control required" value="" name="mobile" required>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="form-group">
                                <div class="col-md-6 col-sm-6">
                                    <label>收货人姓名 *</label>
                                    <input type="text" class="form-control required" value="" name="accept_name"
                                           required>
                                </div>
                                <div class="col-md-6 col-sm-6">
                                    <label>电话号码 </label>
                                    <input type="text" class="form-control " value="" name="phone">
                                </div>
                            </div>
                        </div>


                        <div class="row">
                            <div class="form-group">
                                <div class="col-md-12 col-sm-12">
                                    <label>
                                        设为默认地址

                                    </label>
                                    <!-- checkbox -->
                                    <label class="checkbox">
                                        <input type="checkbox" value="1" name="is_default">
                                        <i></i> 设置为默认收货地址
                                    </label>
                                </div>
                            </div>
                        </div>

                    </fieldset>
                    <div class="row">
                        <div class="col-md-12">
                            <button class="btn btn-3d btn-teal btn-lg btn-block margin-top-30" type="submit">
                                保存收货人地址
                            </button>
                        </div>
                    </div>

                </form>
            </div>

        </div>
    </div>
</div>

{% endblock %}

{% block script%}
<!-- PAGE LEVEL SCRIPTS -->
<script type="text/javascript" src="/static/assets/js/view/demo.shop.js"></script>
{% endblock %}